//
//  RCFeedbackDataModel.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-6-24.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "RCFeedbackDataModel.h"
#import "FrameworkRelativeDefines.h"

@implementation RCFeedbackDataModel


-(id) init
{
    self = [super init];
    if ( nil == self )
        return nil;
    
    return self;
}

-(void) dealloc
{
    
    [super dealloc];
}


// 构造模拟数据
+(void) buildSimulationData:(RCFeedbackDataModel *)dataModel
{
    dataModel.errorNO = 0;
}

+ (id)parseDataFromJSON:(NSDictionary *)data
{
    // 输入参数判断
    if ( nil == data )
        return nil;
    
    // 分配数据模型对象内存
    RCFeedbackDataModel *retObject = nil;
    retObject = [[RCFeedbackDataModel alloc] init];
    if ( nil == retObject )
        return retObject;
    
#ifdef USE_SIMULATION_DATA
    // 构造模拟数据
    [self buildSimulationData:retObject];
    return [retObject autorelease];
#endif
    
    retObject.errorNO = [data intValueForKey:@"errno" defaultValue:-1];
    retObject.errorMsg = [data stringValueForKey:@"msg"
                                    defaultValue:@""
                                       operation:NSStringOperationTypeTrim];
    
    // 返回结果数据模型
    return [retObject autorelease];
}
@end
